//#define __FORCE_TRACE__
//#define __FORCE_DEBUG__
//#define __FORCE_INFO__
#define THIS_FILE "CQBTraining\fn_playerShot.sqf"
#include <core_macros.h>

TRACE_1("Start",_this);
TMFPROFILERSTART;

private ["_target","_selectionName","_damage","_shooter","_time"];
DEFAULT_PARAM(_target,0,objNull);
DEFAULT_PARAM(_selectionName,1,"");
DEFAULT_PARAM(_damage,2,0);
DEFAULT_PARAM(_shooter,3,objNull);

if (IS_OBJECT(_target) && _selectionName == "" && _damage > 0.05) then {
	if ((_target distance GVAR(CQB_POS)) < GVAR(CQB_SIZE)) then {
		if (!isnull _target && {IS_OBJECT(_shooter)} && {!isnull _shooter} && {isplayer _shooter} && {_shooter != _target}) then {
			TRACE_1("Friendly Fire",_shooter);
			["addScore",[_shooter,-10]] call FUNC(callEvent);
		};
	};
};

TRACE("End");
TMFPROFILERSTOP;
[_damage]